package org.example.ideavr.mapper;

import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.ideavr.pojo.dto.GamePageQueryDTO;
import org.example.ideavr.pojo.entity.Game;

@Mapper
public interface GameMapper {

    Page<Game> pageQuery(GamePageQueryDTO gamePageQueryDTO);

    @Insert("INSERT INTO game (name, description, file_url, img_url, user_id, create_time, update_time, text) VALUES " +
            "(#{name}, #{description}, #{fileUrl}, #{imgUrl}, #{userId}, #{createTime}, #{updateTime} , #{text})")
    void insert(Game game);

    @Select("SELECT * FROM game WHERE id = #{gameId}")
    Game selectById(Long gameId);


    void updateById(Game game);
}
